package com.frankie.weibo.miweibo.base;

import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.frankie.weibo.MiApplication;
import com.frankie.weibo.R;
import com.frankie.weibo.miweibo.widget.LoadingDialog;

public class BaseActivity extends AppCompatActivity {

    public Context mContext;
    private LoadingDialog loadingDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        MiApplication.getInstance().addActivity(this);
        mContext = this;
        overridePendingTransition(R.anim.zoomin, R.anim.zoomout);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        MiApplication.getInstance().removeActivity(this);
    }

    public void showLoading() {
        if (loadingDialog == null) loadingDialog = new LoadingDialog(this);
        loadingDialog.show();
    }

    public void closeLoading() {
        if (loadingDialog != null) loadingDialog.dismiss();
    }

}
